package it.unibo.convoycruisecontrol.simulation;

import it.unibo.contact.boatSubSystem.BoatSubSystemLauncher;
import it.unibo.convoycruisecontrol.boatsubsystem.IBoatFactory;
import it.unibo.convoycruisecontrol.boatsubsystem.ObservableDashboard;
import it.unibo.convoycruisecontrol.boatsubsystem.presentation.swing.DashboardView;
import it.unibo.convoycruisecontrol.simulation.presentation.swing.SimulatorController;
import it.unibo.convoycruisecontrol.simulation.presentation.swing.SimulatorFrame;
import it.unibo.convoycruisecontrol.simulation.presentation.swing.SimulatorView;
import it.unibo.java.location.JavaLocationDeviceFactory;
import it.unibo.location.LocationDevice;

public class SimulatorBoatLauncher extends BoatSubSystemLauncher 
{
	@Override
	protected void configureSubjects() 
	{
		refreshPeriod = 3000;			// Aumento la frequenza di refresh visto che siamo su java SE
		
		super.configureSubjects();
	}

	@Override
	protected IBoatFactory getBoatFactory(String className) 
	{
		return new SimulatorBoatFactory();
	}

	@Override
	protected LocationDevice getLocationDevice(String deviceName) 
	{
		JavaLocationDeviceFactory devFactory = new JavaLocationDeviceFactory();
		return devFactory.createBestDevice();
	}

	@Override
	protected void initGui()
	{
		Simulator sim = new Simulator(boat);
		SimulatorController controller = new SimulatorController(sim);
		SimulatorView simView = new SimulatorView(controller);
		DashboardView dashView = new DashboardView((ObservableDashboard) dashboard);
		new SimulatorFrame(simView, dashView);
	}

}
